<?php
/**
 * Created by PhpStorm.
 * User: wanghaibo
 * Date: 17/5/2
 * Time: 15:25
 */

namespace Portal\Model;


use Common\Model\CommonModel;

class ManuModel extends CommonModel
{
    protected $tableName = 'manu';
    protected $_auto = array (
        array('site', 'getSite', self::MODEL_BOTH, 'callback' ),
    );
    //自动验证
    protected $_validate = array(
        //array(验证字段,验证规则,错误提示,验证条件,附加规则,验证时间)
        array('name', 'require', '厂商名称不能为空！', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('name','require','该厂商已存在!',0,'unique'),
        array('tel', 'require', '厂商电话不能为空！', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('tel', 'checkMobile', '请输入正确的联系方式！', 1, 'callback', CommonModel:: MODEL_BOTH   ),
        array('address', 'require', '厂商地址不能为空！', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
    );
    public function getSite($data){
        return join(',',$data);
    }
}